package wine.logic.interfaces;

import java.util.HashMap;
import java.util.Map;

import javax.ejb.Remote;
import javax.ejb.Stateless;

import wine.ejb.utilities.BaseSessionBean;
import wine.logic.bean.WUsrInfDao;
import wine.logic.entity.WUsrInf;
import wine.ejb.utilities.Md5;

@Stateless
@Remote(WUsrInfDao.class)
public class WUsrInfImpl extends BaseSessionBean<WUsrInf> implements WUsrInfDao {

	@Override
	public WUsrInf validLogin(String loginCode, String passwd) {
		String ejbSql = " from WUsrInf where upper(loginCode)=:loginCode and passwd=:passwd ";
		Map<String,Object> parameters = new HashMap<String, Object>();
		parameters.put("loginCode", loginCode.toUpperCase());
		parameters.put("passwd", Md5.encrypt(passwd));
		return super.findObjByEJBQL(ejbSql, parameters);
	}

	
}
